Tone correcting apparatus providing improved tone correction on image

ABSTRACT

A tone correcting apparatus includes: a first acquiring unit that acquires first brightness information indicating brightness of each of a plurality of block regions that are set to cover an entire area of an image; a face detecting unit that detects a face portion where a human face is positioned in the image; a second acquiring unit that acquires second brightness information indicating brightness of the face portion detected by the face detecting unit; and a correction unit that corrects brightness of the image based on the first brightness information and the second brightness information.

CROSS-REFERENCE TO THE RELATED APPLICATION(S)

The present application is based upon and claims priority from priorJapanese Patent Application No. 2007-224985, filed on Aug. 31, 2007, theentire content of which are incorporated herein by reference

TECHNICAL FIELD

The present invention relates to a tone correcting apparatus, a methodfor correcting a tone of an image, and a computer-readable storagemedium containing a sequence of instructions for a program executable bya computer for correcting a tone of an image, which are suitable to beutilized in an image processing apparatus, such as a digital camera.

BACKGROUND

Conventionally, as a method of automatically correcting a tone of animage, there has been a method in which a brightness level of an imageis corrected for each of pixels included in the image. An example ofsuch method is described in JP-A-9-065252 (counterpart U.S. Pat. No.5,808,697). In the method, an input image is divided into a plurality ofblock regions, and an average brightness level (an average of brightnesslevels of all pixels) is obtained for each of the block regions. Next, acorrection curve is independently selected for each of the block regionscorresponding to the average brightness level. Next, a plurality oftypes of correction curves selected for a block region (a main blockregion) including a target pixel and for a plurality of block regions(subsidiary block regions) which are adjacent to the main block regionare subjected to a weighted average to generate a new correction curve,and the new correction curve is used to correct the brightness level ofthe target pixel. According to the method described above, it ispossible to prevent the details of a local portion in the image frombeing lost by performing a tone correction on the image.

According to the conventional method, it is possible to prevent thedetails of the local portion from being lost with the tone correction.However, the conventional tone correction is designed for ageneral-purpose use, and its effect may be limited in some cases. Forexample, in a case in which a human face exists in an image to besubjected to the tone correction, a contrast between a bright portionand a dark portion in the face portion tends to be deteriorated, andwhen a brightness of a face portion, where the human face is positioned,and a brightness of background portion largely differ from each other,the face portion becomes unnaturally bright or dark by the tonecorrection. As described above, the conventional tone correction may notapply a favorable correction to the face portion.

SUMMARY

One of objects of the present invention is to provide a tone correctingapparatus, a tone correcting method and a tone correcting program, whichprovides a tone correction while maintaining appropriate tone in a faceportion, where a human face is positioned, in an image subjected to thetone correction.

According to a first aspect of the present invention, there is provideda tone correcting apparatus for correcting a tone of an image, theapparatus including: a first acquiring unit that acquires firstbrightness information indicating brightness of each of a plurality ofblock regions that are set to cover an entire area of an image; a facedetecting unit that detects a face portion where a human face ispositioned in the image; a second acquiring unit that acquires secondbrightness information indicating brightness of the face portiondetected by the face detecting unit; and a correction unit that correctsbrightness of the image based on the first brightness information andthe second brightness information.

According to a second aspect of the present invention, there is provideda method for correcting a tone of an image, the method including:acquiring first brightness information indicating brightness of each ofa plurality of block regions that are set to cover an entire area of theimage; detecting a face portion where a human face is positioned in theimage; acquiring second brightness information indicating brightness ofthe face portion; and correcting brightness of the image based on thefirst brightness information and the second brightness information.

According to a third aspect of the present invention, there is provideda computer-readable storage medium containing a sequence of instructionsfor a program executable by a computer for correcting a tone of animage, the program including: instructions for acquiring firstbrightness information indicating brightness of each of a plurality ofblock regions that are set to cover an entire area of the image;instructions for detecting a face portion where a human face ispositioned in the image; instructions for acquiring second brightnessinformation indicating brightness of the face portion; and instructionsfor correcting brightness of the image based on the first brightnessinformation and the second brightness information.

BRIEF DESCRIPTION OF THE DRAWINGS

In the accompanying drawings:

FIG. 1 is a block diagram showing a tone correcting apparatus accordingto a first embodiment of the present invention;

FIG. 2 is an explanatory diagram showing a block region in an inputimage;

FIG. 3 is a diagram showing a relationship between a combination offirst and second brightness levels and a third brightness level;

FIG. 4A is a diagram showing a block region in an input image and acenter pixel thereof;

FIG. 4B is a conceptual diagram showing a relationship between thecenter pixel and the other pixels in an interpolation of a correctioncharacteristic;

FIG. 5A shows Equation (2) expressing a basic gain function;

FIGS. 5B and 5C are charts for explaining an adjustment characteristicof a gain with a change in a V value which is obtained by the gainfunction;

FIG. 6A shows Equation (3) expressing a gain function obtained after again limit;

FIGS. 6B and 6C are charts for explaining an adjustment characteristicof a gain with a change in a V value which is obtained by a limited gainfunction;

FIG. 7 is a diagram showing a method of setting a gain limitcoefficient;

FIG. 8A shows Equation expressing a clipped gain function;

FIGS. 8B and 8C are charts for explaining an adjustment characteristicof a gain with a change in a V value which is obtained by a clipped gainfunction;

FIG. 9 is a view showing a method of performing a highlightdetermination;

FIG. 10 is a flowchart schematically showing a tone correcting procedurein the tone correcting apparatus according to the first embodiment;

FIG. 11 is a block diagram showing a tone correcting apparatus accordingto a second embodiment of the present invention;

FIG. 12 is an explanatory diagram showing a face portion and a faceblock in an input image;

FIG. 13 is a flowchart showing specific details of an adjustment ofbrightness level in each block region performed by a determinationadjustment unit;

FIG. 14A shows Equation (14) expressing a gain limit coefficient;

FIG. 14B is a chart for explaining an adjustment characteristic of again which is obtained by using the gain limit coefficient;

FIG. 15 is a flowchart showing a detail of an operation of the tonecorrecting apparatus according to the second embodiment;

FIG. 16 is a flowchart showing a detail of an operation of the tonecorrecting apparatus according to the second embodiment; and

FIGS. 17A and 17B are explanatory diagrams showing an example of a casein which an excess and deficiency is generated on a gain in pixelswithin the face portion.

DETAILED DESCRIPTION

Embodiments according to the present invention will be described indetail with reference to the accompanying drawings. The scope of theclaimed invention should not be limited to the examples illustrated inthe drawings.

First Embodiment

A first embodiment according to the present invention will be describedbelow. FIG. 1 is a block diagram showing a configuration of a tonecorrecting apparatus 500 according to the first embodiment. The tonecorrecting apparatus 500 serves to automatically correct a tone of aninput image. The tone correcting apparatus 500 is incorporated andutilized in an image capturing apparatus, such as a digital camera, andan image processing apparatus, such as a printer, which have variousimage processing functions.

As shown in FIG. 1, the tone correcting apparatus 500 includes: an inputunit 1 for inputting image data including pixel data for each of colorcomponents of R, G and B; a V value converter 2; a V value averagecalculator 3; a first key determination unit 4; a second keydetermination unit 5; a third key determination unit 6; a histogramgenerator 7; a correction gain calculator 8; a coordinate counter 9; atone converter 10; and an output unit 11. The tone converter 10 adjusts,for each pixel, a gain of image data input to the input unit 1.

The input unit 1 is, for example, configured by a frame memory or avideo RAM which is implemented by a semiconductor memory chip.

The V value converter 2 serves as an acquiring unit and serves toconvert pixel values (R, G and B values) of the image data input to theinput unit 1 into a value having V (value: brightness) component in anHSV color space. The V value converter 2 outputs a converted V value(Vin) to the V value average calculator 3 and the histogram generator 7.As is well known, the V value is a maximum value among each of the R, Gand B values and is converted in accordance with the following equation(1).

Vin=max(Rin, Gin, Bin)   (1)

The V value average calculator 3 divides an input image into a pluralityof predetermined block regions. The V value average calculator 3 setsthe divided block regions into focused regions respectively andcalculates an average value of the V values for all pixels in therespective regions (which will be hereinafter referred to as an averageV value) for two types of key determining regions having different areasrespectively. FIGS. 2A and 2B are explanatory diagrams showing a blockregion 101 in an input image 100, and a region being hatched in FIGS. 2Aand 2B indicates a key determining region.

As shown in FIG. 2A, the V value average calculator 3 sets the blockregion 101 (indicated by A in the drawing) itself to be a focused regionas a first key determining region A, thereby calculating an average Vvalue. As shown in FIG. 2B, the V value average calculator 3 sets, as asecond key determining region (an inclusive region) B, a regionconstituted by the block region 101 (A in the drawing) to be the focusedregion and eight other block regions 101 (B1, B2, . . . , B8 in thedrawing) which are adjacent to and surround the focused region, therebycalculating the average V value.

The first key determination unit 4 determines any brightness level(hereinafter referred to as a first brightness level) in a brightnessreference (a first brightness reference) leveled into a plurality ofpredetermined levels to which a brightness in the first key determiningregion A corresponds based on the average V value in the same regionwhich is calculated by the V value average calculator 3. In thefollowing description, the determination process will be referred to asa first key determination. The brightness level to be determined isdivided into three levels of “Low”, “Middle” and “High”. A range of theaverage V value corresponding to each brightness level is obtained bydividing a full range (“0” to “MAX”) of the average V value into threeequal parts, for example. The V value average calculator 3 and the firstkey determination unit 4 serve as a first determination unit.

The second key determination unit 5 determines any brightness level(hereinafter referred to as a second brightness level) in a brightnessreference (a second brightness reference) leveled into a plurality ofpredetermined levels to which a brightness in the second key determiningregion B corresponds based on the average V value in the same regionwhich is calculated by the V value average calculator 3. In thefollowing description, the determination process will be referred to asa second key determination. The brightness level to be determined isalso based on the same reference as that in the first key determinationand is “Low”, “Middle” or “High”. The V value average calculator 3 andthe second key determination unit 5 serve as a second determinationunit.

The third key determination unit 6 serves as a third determination unitand determines a relevance to a brightness level corresponding to acombination of results of the first and second key determinations (thefirst and second brightness levels), that is, any brightness level(hereinafter referred to as a third brightness level) in a brightnessreference (a third brightness reference) leveled in more detail than thebrightness reference described above. In other words, the third keydetermination unit 6 determines a brightness level considering arelative brightness relationship between the eight other block regions101 (B1, B2, . . . , B8) which are adjacent to the surroundings of theblock region 101 to be the focused region for the same block region 101.

In the embodiment, a brightness level to be determined in the third keydetermination is set to any of six levels including “Low 1”, “Low 2”,“Middle 1”, “Middle 2”, “High 1” and “High 2”, and the “Low 1” indicatesthe lowest level and the “High 2” indicates the highest level Arelationship between a combination of the first and second brightnesslevels and the third brightness level is previously defined, forexample, as shown in FIG. 3.

The histogram generator 7 serves as histogram acquiring unit and countsthe number of pixels for each V value from the V values (Vin) of all thepixels converted by the V value converter 2, arid outputs, to thecorrection gain calculator 8, a result of the count as histograminformation indicative of a distribution of brightness in the wholeinput image.

The correction gain calculator 8 serves as a first characteristicsetting unit, a second characteristic setting unit, a calculation unit,a contrast determination unit, an upper limit adjusting unit, adistribution status determination unit, and a lower limit adjustingunit. The correction gain calculator 8 individually calculates acorrecting gain in the adjustment of the gain for each pixel through thetone converter 10 using a gain function (a correction function) whichwill be described below, that is, a correction coefficient for a tonecorrection to be multiplied by each pixel value of image data based onthe result of the third key determination and the histogram informationand sets the correction coefficient to the tone converter 10.

The coordinate counter 9 counts a coordinate position (a transverseposition and a longitudinal position) of a pixel to be a gaincalculating target in the correction gain calculator 8.

The tone converter 10 serves as a correction unit and serves to adjust again of image data every pixel with the gain calculated for each pixelin the correction gain calculator 8. More specifically, the toneconverter 10 converts the pixel value (the R, G or B value) of eachpixel into a pixel value obtained by multiplying the gain. The toneconverter 10 outputs, to the output unit 11, image data obtained afterthe gain adjustment.

The output unit 11 is, for example, configured by a frame memory or avideo RAM which is implemented by a semiconductor memory chip. Theoutput unit 11 may be configured as the same component as the input unit1.

Detailed description will be given to the operation for calculating acorrecting gain in the correction gain calculator 8. First, thecorrection gain calculator 8 individually sets, to all of the pixels, again adjustment characteristic for a change in the V value of each ofthe pixels which is a basis in the gain calculation, that is, acorrection characteristic obtained by a gain function which will bedescribed below.

More specifically, there is set, as a typical correction characteristic,a correction characteristic corresponding to the third brightness leveldetermined every block region 101 through the third key determinationfrom plural types of correction characteristics which are predeterminedcorresponding to the brightness levels in the six levels including the“Low 1”, “Low 2”, “Middle 1”, “Middle 2”, “High 1” and “High 2” (seeFIG. 3) for a center pixel of each of the block regions 101.

A new correction characteristic is acquired through a linearinterpolation from the typical correction characteristic set to thecenter pixels which are adjacent to pixels other than the center pixeland is set to the pixels other than the center pixel. Referring to theinterpolation of the correction characteristic set to the other pixels,it is also possible to employ another interpolating method such as aspline interpolation in place of the linear interpolation.

FIG. 4A is a diagram showing nine block regions obtained by dividing theinput image 100 and their center pixels (“+” in the drawing) and FIG. 4Bis a diagram showing a relationship between pixels other than the centerpixel (“·” in the drawing) and the center pixel used for an acquirement(interpolation) of the correction characteristic of the pixel As shownin FIG. 4B, in the interpolation of the correction characteristics setto the other pixels, the typical correction characteristics for fourcenter pixels at a maximum which are adjacent to the same pixels areused. Referring to the pixels in the block regions positioned in upper,lower, left and right corner portions of the input image, the typicalcorrection characteristics set to the center pixels in the block regionsare exactly set as the correction characteristics.

Next, detailed description will be given to the typical correctioncharacteristic and the correction characteristic.

The typical correction characteristic and the correction characteristicwhich are set to each pixel are obtained by a gain function g (Vin, lev,x) expressed in Equation (2) shown in FIG. 5A. The correction gaincalculator 8 sets, as the typical correction characteristic or thecorrection characteristic for each pixel, values of a gain level (lev)and a degree (x) to be parameters (variables) for predetermining thecharacteristic in the gain function g (Vin, lev, x).

FIGS. 5B and 5C are charts showing an adjustment characteristic of thegain (g) for a change in the V value (Vin) obtained by the gain functiong (Vin, lev, x), and the gain (g) calculated through the gain function g(Vin, lev, x) is decreased with an increase in the V value (Vin) and is1.0 when the “V value=MAX.” Moreover, a difference in the value of theparameter is reflected by the characteristic in the following manner.

More specifically, a value of the degree (x) is equal as shown in FIG.5B, the whole gain (g) is increased with an increase in the gain level(lev) and a maximum value of the gain (g) is a double with “lev=2”. Inthe case in which a value of the gain level (lev) is equal as shown inFIG. 5C, the gain (g) in a region having a middle brightness,particularly, a highlight (a maximum V value) side is reduced with anincrease in the degree (x) and the gain (g) on the highlight side (alarger V value side) is equal to or smaller than 1.0 depending on thevalue.

In other words, when the gain set to the gain converter 10 is to becalculated every pixel by using the gain function g (Vin, lev, x), it ispossible to enhance a tone in a dark portion of the input image if thegain level (lev) is increased to wholly cause the gain to be larger. Atthe same time, it is possible to reduce a whiteout (or “blown out”) in abright portion of the input image if the degree (x) is increased tocause the gain on the highlight (the maximum V value) side to be equalto or smaller than 1.0.

For this reason, a value decreased in order with an increase in thebrightness level is set to the gain level (lev) corresponding to each ofthe brightness levels in the six levels (“Low 1”, . . . , “High 2”) anda value increased in order with the increase in the brightness level isset to the degree (x) corresponding to each of the brightness levels,which is not shown. Moreover, the values of both of the parameters (lev,x) are previously determined based on an empirical rule.

In the correction gain calculator 8, the gain function g (Vin, lev, x)is not exactly used to calculate the gain but the gain is calculatedthrough a gain function glim (Vin, lev, x) expressed in Equation (3)shown in FIG. 6A.

[0043-1]

The parameter (lim) in the gain function glim (Vin, lev, x) is a gainlimit coefficient for determining the upper limit of the gain. Bysetting the value to be equal to or smaller than 1.0, it is possible toadjust the upper limit of the gain corresponding to the value of thegain level (lev) A value of the gain limit coefficient is set to beequal over the whole image (all pixels). In the following description,the gain function glim (Vin, lev, x) will be simply referred to as a“limited gain function”.

FIG. 6B is a chart showing an adjustment characteristic of a gain for achange in the V value of each pixel with “lim=1”. In this case, there isobtained the same characteristic as that in the case in which the gainlimit is not performed. FIG. 6C is a chart showing an adjustmentcharacteristic of a gain for a change in the V value of each pixel with“lim=0.5”. By setting the gain limit coefficient to be equal to orsmaller than 1.0, it is possible to reduce the gain for the pixel on aside where the V value is larger when the value of the gain level (lev)is smaller. In other words, it is possible to enhance a contrast of animage (i.e. the blackness of the dark portion) by reducing the gain fora pixel in the dark portion.

The value of the gain limit coefficient (lim) is set corresponding tothe contrast of the image. In the embodiment, a contrast determinationfor determining (estimating) a contrast status of an image is performedbased on the result of the third key determination to set a valuecorresponding to a result of the determination.

More specifically, the number of the block regions in the “Low 1” inwhich the brightness level is the lowest in the third key determinationand that of the block regions in the “High 2” in which the brightnesslevel is the highest are individually counted and it is ascertainedwhether each count number is equal to or larger than a threshold (N, M)determined every level or is smaller than the threshold (N, M) for bothof the brightness levels. As shown in FIG. 7, the contrast status isdetermined based on a combination of the number of the “Low 1” (thenumber which is equal to or larger than N and the number which issmaller than N) and the number of the “High 2” (the number which isequal to or larger than M and the number which is smaller than M) andthe gain limit coefficient is set corresponding to the result of thedetermination.

FIG. 7 shows an example of the case in which the contrast status isdivided into four levels to perform a determination. For example, whenthe number of the “Low 1” is equal to or larger than the threshold N andthe number of the “High 2” is equal to or larger than the threshold M,it is determined that the contrast of the image is the highest and thevalue of the gain limit coefficient is set to be “1.0”. In other words,the contrast enhancement is not substantially performed. When the numberof the “Low 1” is smaller than the threshold N and the number of the“High 2” is smaller than the threshold M, it is determined that thecontrast of the image is the lowest and the value of the gain limitcoefficient is set to be “0.5”.

On the other hand, it is possible to enhance the contrast of the image(i.e. the blackness of the dark portion) by using the limited gainfunction to adjust the upper limit of the gain for each pixel. Also inthat case, as shown in FIG. 5C, the gain (g) on the highlight side (theside where the V value is great) excluding a highlight portion (a pixelportion having the V value to be a maximum value) is equal to or smallerthan 1.0 when the value of the degree (x) set to each pixel is increasedto some degree in the calculation of the gain. In other words, a pixelvalue of a bright portion in the image is subjected to a negativecorrection.

This causes a useless reduction in a contrast in an image having a poortone in a bright portion and results in a tone jump in which a greattone difference is made between a portion having a whiteout causedtherein and a close portion to the whiteout therearound (the vicinity ofthe maximum value of the V value) in an image having a large whiteout (alarge number of whiteout portions).

For this reason, in the correction gain calculator 8, it is determinedwhether or not the negative correction of a pixel value for a pixel in abright portion is inappropriate for the input image, that is, the inputimage has a poor tone in the bright portion or a large whiteout in thecalculation of the gain of each pixel) (which will be hereinafterreferred to as a highlight determination). If it is determined that thenegative correction is inappropriate for the image, a gain is calculatedthrough a gain function gclip (Vin, lev, x) expressed in Equation (4)shown in FIG. 8A.

In other words, by clipping (limiting) a lower limit of the gain to“1.0”, it is possible to avoid a useless reduction in a contrast in thecase in which the input image has a poor tone in the bright portion anda generation of a tone jump in the case in which the image has a largewhiteout. In the following description, the gain function gclip (Vin,lev, x) will be simply referred to as a “clipped gain function”.

FIGS. 8B and 8C are charts showing a difference in an adjustmentcharacteristic of a gain depending on the presence of the clip in thecase in which the value of the gain limit coefficient (lim) is set to be“1.0”. FIG. 8B shows an adjustment characteristic obtained when the clipis not performed and FIG. 8C shows an adjustment characteristic obtainedwhen the clip is performed.

Moreover, the highlight determination is performed in the followingmanner based on the histogram information acquired by the histogramgenerator 7 (the distribution of brightness depending on the number ofpixels for each V value in the whole image). More specifically, as shownin an upper section of FIG. 9, when the number of pixels having a largertone value than a tone value X in a tone position from a maximum tonevalue (a maximum V value) to several percent (for example, 5% to 10%) isequal to or smaller than a predetermined certain number, it isdetermined that the input image has a poor tone in the bright portionand the negative correction is inappropriate for the input image. Asshown in a lower section of FIG. 9, when the number of pixels of themaximum tone value (the maximum V value) is equal to or larger than thepredetermined certain number, it is determined that the input image hasa large whiteout and the negative correction is inappropriate for theinput image. As shown in a middle section of FIG. 9, when the number ofpixels having a larger tone value than a tone value X exceeds thepredetermined certain number and the number of pixels having the maximumtone value (the maximum V value) is smaller than the predeterminedcertain number, that is, the same number corresponds to neither of thetwo determining conditions, it is determined that the input image has ahigh tone in the bright portion and the negative correction isappropriate for the input image.

The histogram information to be used for the highlight determinationindicates the distribution of brightness depending on the number ofpixels for each V value to be a maximum value of each of the R, G and Bvalues. For this reason, also in the case in which the input image has alarge number of portions in which a color saturation is generated, it ispossible to determine that the negative correction is inappropriate forthe input image in the same manner as in an image having a largewhiteout. Therefore, it is possible to simultaneously avoid thegeneration of the tone jump in the vicinity of the portion in which thecolor saturation is generated in addition to the tone jump in thevicinity of the portion in which the whiteout is generated.

As described above, the correction gain calculator 8 calculates a gainfor each pixel by using the clipped gain function gclip (Vin, lev, x) inthe case in which a gain clip is required for the input image and setsthe same gain as a correcting gain to the tone converter 10 depending onthe result of the highlight determination. Furthermore, the correctiongain calculator 8 calculates a gain for each pixel by using the limitedgain function glim (Vin, lev, x) for the case in which the gain clip isnot required for the input image and sets the same gain as a correctinggain to the tone converter 10.

The tone converter 10 adjusts a pixel value of image data every pixelbased on the gain calculated corresponding to the result of thehighlight determination through the correction gain calculator 8. Morespecifically, pixel values Rin, Gin and Bin for R, G and B of each inputpixel are converted into pixel values Rout, Gout and Bout obtained inaccordance with the following equations (5), (6) and (7) or equations(8), (9) and (10).

Rout=Rin×glim(Vin, lev, x)   (5)

Gout=Gin×glim(Vin, lev, x)   (6)

Bout=Bin×glim(Vin, lev, x)   (7)

Rout=Rin×gclip(Vin, lev, x)   (8)

Gout=Gin×gclip(Vin, lev, x)   (9)

Bout=Bin×gclip(Vin, lev, x)   (10)

In other words, the tone converter 10 individually corrects a brightnesslevel (brightness) of each pixel of the input image in accordance with acorrection characteristic set to each pixel. Consequently, it ispossible to automatically correct the tone of the input image.

FIG. 10 is a flowchart schematically showing a tone correcting procedurein the tone correcting apparatus 500. As shown in FIG. 10, step S1indicates an operation of the V value average calculator 3, steps S2 toS4 indicate operations of the first key determination unit 4, the secondkey determination unit 5 and the third key determination unit 6respectively, and steps S5 to S12 indicate an operation of thecorrection gain calculator 8. The operations of steps S12 and S13 areactually executed repetitively at a number of times corresponding to thenumber of pixels Moreover, the details of the respective steps will beomitted in order to reduce repetitive description.

As described above, in the tone correcting apparatus 500 according tothe embodiment, the brightness level of each of the block regions 101 toe a reference for determining the correction characteristic in thecalculation of the gain for each pixel is not obtained from onlybrightness information such as an average V value of a pixel in theregion but is obtained from the determination processes in three levelsincluding the first key determination, the second key determination andthe third key determination. In other words, there is obtained thebrightness level considering a relationship of a relative brightnesswith the surroundings as described above. Therefore, the tone correctingapparatus 500 can obtain an excellent tone result for the vicinity of aboundary between bright and dark portions in an image by correcting abrightness of each pixel based on the brightness level. In other words,the tone correcting apparatus 500 can perform a more appropriate tonecorrection by which the feature of each portion in the image isprecisely reflected.

In the calculation of the gain for each pixel, the contrastdetermination is made for the input image to adjust the upper limit ofthe gain to be set to each pixel corresponding to the result of thedetermination. Consequently, it is possible to reduce a gain for thepixel in the dark portion as described above. As a result, it ispossible to enhance the contrast of the image (i.e. the blackness of thedark portion).

In the calculation of the gain for each pixel, the highlightdetermination is performed for the input image and it is determinedwhether the negative correction of the pixel value for the image in thebright portion is inappropriate for the input image or not. If thenegative correction is inappropriate for the image, the lower limit ofthe gain to be set every pixel is clipped (limited) to “1.0”.Consequently, it is possible to prevent a useless reduction in acontrast in the case in which the input image has a poor tone in thebright portion, and a generation of a tone jump in the case in which theinput image has a large whiteout and the generation of the tone jumparound a portion in which a color saturation is caused.

In the tone correcting apparatus 500, an optional method can be employedfor a specific method for individually correcting a brightness of eachpixel of an input image based on the brightness level of each of theblock regions 101. In the description, although the typical correctioncharacteristic is set to the center pixel of each of the block regions101 based on the brightness level of each of the block regions 101 andthe correction characteristics of the pixels other than the center pixelare set based on the typical correction characteristic, and the gain ofeach of the pixels is regulated in accordance with the typicalcorrection characteristic and the correction characteristics, thebrightness of each of the pixels may be individually corrected by usingother methods.

In the embodiment, any of the brightness levels in the six levels towhich the brightness of each of the block regions 101 corresponds isdetermined through the third key determination and the correctioncharacteristic corresponding to the result of the third keydetermination is selected (set) for each of the block regions 101, andis set as the typical correction characteristic to the center pixel ofeach of the block regions 101. However, the correction characteristic tobe set as the typical correction characteristic may be directly selectedbased on only the combination of the brightness level determined throughthe first key determination and the brightness level determined throughthe second key determination without the execution of the third keydetermination In that case, the contrast determination for determiningthe upper limit of the gain set to each pixel is performed based oninformation other than the result of the third key determination. Thiswill be described below.

In the embodiment, the input image 100 is divided into the block regions101 and the brightness level (brightness) of each pixel is correctedevery pixel based on the brightness level of each of the block regions101. However, each of the block regions does not need to be obtained bydividing the input image 100 but a plurality of block regions in whichthe adjacent block regions partially overlap each other may be set andthe brightness level (brightness) of each pixel may be corrected everypixel based on the brightness level of each of the block regions.

While the brightness levels of the first and second key determiningregions A and B are divided in the three levels including “Low”,“Middle” and “High”, the number of the levels of the brightness level tobe determined may be two or four or more. In addition, the numbers ofthe levels of the brightness levels to be determined in the first andsecond key determining regions A and B may be different from each other.

In the case in which the numbers of the levels are set to be equal toeach other in the same manner as in the embodiment, it is also possibleto perform weighting over the result of the second key determination bychanging criteria in the first key determination for the first keydetermining region A and the second key determination for the second keydetermining region B, that is, a relationship between the average Vvalue and the brightness level, for example.

In the embodiment, the brightness level of each of the block regions 101which is to be finally determined in the third key determination, thatis, the brightness to be the reference for determining the typicalcorrection characteristic set to each of the center pixels is determinedin the six levels including the “Low 1” to “High 2”. However, the numberof the levels for the brightness to be the reference for determining thetypical correction characteristic may be changed. It is possible toperform the tone correction more precisely in a larger number of levelsfor the brightness level to be determined. For this reason, it isdesirable that the number of the levels for the brightness level to bedetermined in the third key determination should be larger than that ofthe levels for the brightness level in the determination of thebrightness in each of the first and second key determining regions A andB as in the embodiment.

Although the brightness level of each of the block regions 101 to befinally determined is determined through the determination processes inthe three levels including the first key determination, the second keydetermination and the third key determination in the embodiment, thedetermination may be performed in the following manner. For example, itis also possible to further set another key determining region includingthe second key determining region B on an outside thereof, to determinea brightness of the same determining region, and to determine thebrightness of each of the block regions 101 which is to be finallydetermined based on the combination of the result of the determinationand the results of the first and second key determinations, that is, todetermine the brightness level of each of the block regions 101 throughthe determination processes in four levels.

In the embodiment, the brightness level of each of the block regions isdetermined based on the V value of each pixel (more specifically, theaverage V value of each of the block regions). However, the brightnesslevel of each of the block regions may be determined based on otherbrightness information such as a Y (brightness) value obtained from theR, G and B values of each pixel. In some cases in which the brightnessinformation other than the V value is used, the color saturation cannotbe determined and an unnecessary gain is given to the color saturationportion. For this reason, it is desirable to use the V value for thebrightness information. In addition, the brightness level of each of theblock regions is not limited to the average of the V values or the Yvalues of the respective pixels but may be determined based on theirhistogram.

In the embodiment, the correction characteristic set to each of theblock regions 101 (the typical correction characteristic set to thecenter pixel) is set to have the values of the parameters of the gainfunction (the gain function to be a basis) which is used in thecalculation of the gain for each pixel of the input image, that is, thegain level (lev) and the degree (x), and the values of the parametersare set to each of the block regions 101 corresponding to the result ofthe third level determination, and the gain for each pixel is calculatedbased thereon. However, the processing may be changed as follows, forexample.

For example, it is also possible to predetermine a combination of aplurality of V values indicative of a plurality of typical points (16points) exist at a predetermined V value interval over a gain curverepresenting each correction characteristic and a gain (g) as correctioncharacteristics corresponding to the number of levels for the brightnesslevel to be determined in the third level determination and to set themto each of the block regions 101 corresponding to the result of thethird level determination. In that case, referring to the center pixelof each of the block regions 101, the gain (g) corresponding to the Vvalue (Vin) of the center pixel is determined by using the gain curverepresented by the typical points corresponding to the result of thethird level determination for each of the block regions 101. Referringto the pixels other than the center pixel, the typical pointscorresponding to the result of the third level determination in each ofthe block regions 101 including the center pixels which are adjacentthereto are used to interpolate new typical points from the typicalpoints having equal V values respectively, and a gain curve connectingthe new typical points thus obtained is used to determine the gain (g)corresponding to the V value (Vin) of the pixel.

In the embodiment, the limited gain function glim (Vin, lev, x) is usedto calculate the gain for each pixel, and the value of the gain limitfunction (lim) is set corresponding to the result of the contrastdetermination, thereby limiting the upper limit of the gain set to eachpixel in that case. However, the processing may be changed as follows,for example.

For example, referring to the input image in which the clip of the gainis not required, the gain of each pixel is calculated by using the gainfunction g (Vin, lev, x) to be the basis, and the values of the gainlevel (lev) and the degree (x) set as the typical correctioncharacteristic to the center pixel of each of the block regions 101 (thevalues corresponding to the result of the third key determination) maybe regulated corresponding to the result of the contrast determinationto adjust the upper limit of the gain set to each pixel. In that case,the limited gain function is obtained by the following equation (11).

gclip(Vin, lev, x)=max {g(Vin, lev, x), 1.0}  (11)

In the embodiment, the contrast status of the input image to be thereference for limiting the upper limit of the gain to be set to eachpixel is determined based on the result of the third key determination.However, the contrast status of the input image may be determined basedon other information. For example, when determining the contrast statusof the input image, it is also possible to use the result of the firstkey determination or that of the second key determination in place ofthe result of the third key determination or to use both of the resultsof the determinations. In the case in which the tone correctingapparatus is employed for a digital camera, the determination may bemade based on an EV value (an exposure time).

In addition, it is also possible to employ a configuration capable ofmanually limiting the upper limit of the gain to be set to each pixelwithout automatically limiting the same upper limit. In that case, it ispreferable to employ a configuration in which a user of the tonecorrecting apparatus can select an enhancing degree of a contrast from aplurality of levels, for example, and to set the gain limit coefficient(lim) to be a predetermined value corresponding to the selected level.

In the case in which the contrast status of the input image isdetermined based on the result of the third key determination, it isalso possible to divide the number of the block regions 101corresponding to the “Low 1” and that of the block regions 101corresponding to the “High 2” into two levels by using thresholds (N, M)respectively as in the embodiment and to simply decide the contraststatus based on a combination of the corresponding number to the “Low 1”and that to the “High 2” or a combination of a corresponding number ofother brightness levels (which may be of three types or more), or basedon only a corresponding number of a certain brightness level in additionto the determination of the contrast status based on the combination ofthe numbers in the two levels. Furthermore, it is also possible todivide a corresponding number of at least one predetermined brightnesslevel into at least three levels by using at least two thresholds,thereby performing a confirmation and to determine the contrast statusbased on their combination.

The technique for performing the contrast determination for the inputimage and limiting the upper limit of the gain to be set to each pixelcorresponding to the result of the determination, that is, the techniquefor limiting the upper limit of the correction coefficient for eachpixel when individually correcting the brightness of the pixel is alsoeffective for the case in which the brightness level of each of theblock regions 101 is determined by a method other than the methoddescribed in the embodiment and the brightness of each pixel isindividually corrected based on the result of the determination.

Although the highlight determination as to whether the negativecorrection of the pixel value for the pixel in the bright portion isinappropriate for the input image is performed based on the histograminformation indicative of the distribution status of the brightnesscorresponding to the number of pixels for each V value of the wholeimage in the embodiment, the histogram information to be used for thehighlight determination may indicate the number of the pixels of the Vvalue (tone) every certain section, for example. In the case in whichthe number of the block regions 101 (the number of divisions for theinput image 100 in the embodiment) is increased to some extent, it isalso possible to use histogram information having, as an element, theaverage V value of each of the block regions 101 or to use histograminformation having, as an element, an average V value acquired bysetting the block regions 101 to be a unit.

While the highlight determination is performed for the whole image andwhether the lower limit of the gain to be set to each pixel is clippedis determined in a lump in the embodiment, the following method may beemployed. For example, it is also possible to acquire the histograminformation about the V value for each of the block regions 101 and toperform the highlight determination every block region 101, and toselect the gain function to be used every block region 101 from thelimited gain function or the clipped gain function in the calculation ofthe gain for each pixel based on a result of the determination. Inaddition, the highlight determination may be performed by setting theblock regions 101 as a unit.

The technique for clipping (limiting) the lower limit of the gain to beset every pixel corresponding to the result of the highlightdetermination, that is, the technique for limiting the lower limit valueof the correction coefficient for each pixel into a predetermined valuewhen individually correcting the brightness of the pixel is alsoeffective for the case in which the brightness level of each of theblock regions 101 is determined by a method other than the methoddescribed in the embodiment and the brightness of each pixel isindividually corrected based on the result of the determination.

Although the second key determining region to be the target region foracquiring the second brightness level is set to be the region (theinclusive region) B constituted by the block region 101 (the region Ashown in FIG. 2B) to be the focused region and eight other block regions101 which are adjacent to the surroundings thereof (the regions B1, B2,. . . B8 shown in FIG. 2B) in the embodiment, the target region foracquiring the second brightness level is not limited thereto in theinvention. For example, only the eight other block regions which areadjacent to the surroundings of the focused region may be set to be thesecond key determining region or some of the eight other block regionswhich are adjacent to the surroundings of the focused region (theregions B2, B4, B5 and B7 shown in FIG. 2B) may be set to be the secondkey determining region.

Furthermore, each component of the tone correcting apparatus 500 may beimplemented by an ASIC (application specific integrated circuit). Inaddition, in the functions implemented by the tone correcting apparatus500, the functions of a whole or part of the portions other than theinput unit 1 and the output unit 11 may be implemented in accordancewith a software program to be executed by a processor provided in acomputer, an imaging apparatus or an image processing apparatus, forexample. In the case in which the function to be implemented by the-tone correcting apparatus 500 is to be implemented into the imagingapparatus such as a digital camera or a digital video camera, forexample, it is also possible to run a tone correcting program forperforming a tone correction processing shown in FIG. 10 through aprocessor included in a computer system provided in the apparatuses. Thetone correcting program can be provided in a form of a recording medium,for example, a non-volatile memory such as a mask ROM or an EPROM(Erasable Programmable ROM), a flash memory device, an optical disk anda magnetic disk. Moreover, the tone correcting program may be providedthrough a wired or wireless computer network.

Second Embodiment

A second embodiment according to the present invention will be describedbelow. In the following description of the second embodiment, identicalor equivalent components and operations to those in the first embodimentwill be described by using the same reference numerals as those in thefirst embodiment with reference to the drawings used in the descriptionof the first embodiment.

FIG. 11 is a block diagram showing a configuration of a tone correctingapparatus 600 according to the second embodiment. The tone correctingapparatus 600 automatically corrects a tone of an input image. The tonecorrecting apparatus 600 is incorporated and utilized in an imagingdevice such as a digital camera, a printer or various image processingapparatuses having various image processing functions.

As shown in FIG. 11, the tone correcting apparatus 600 includes: aninput unit 601 for inputting image data including pixel data for each ofcolor components of R, G and B; a V value converter 602; a V valueaverage calculator 603; a first key determination unit 604; a second keydetermination unit 605; a third key determination unit 606; a facedetecting unit 607; a Y value converter 608; a Y value averagecalculator 609; a face portion key determination unit 610; a face blockkey determination unit 611; a determination adjustment unit 612; ahistogram generator 613; a correction gain calculator 614; a coordinatecounter 615; a tone converter 616; and an output unit 617. The toneconverter 616 adjusts, for every pixel, a gain of the image data inputto the input unit 601.

The input unit 601 is configured by a frame memory or a video RAM, whichis implemented by a semiconductor memory chip.

The V value converter 602 serves to convert pixel values (R, G and Bvalues) of the image data input to the input unit 601 into a valuehaving a V (value : lightness) component in an HSV color space, andoutputs a converted V value (Vin) to the V value average calculator 603and the histogram generator 613. As is well known, the V value is amaximum value for the R, G and B values and is converted in accordancewith the following equation (12).

Vin=max(Rin, Gin, Bin)   (12)

The V value average calculator 603 divides an input image into aplurality of predetermined block regions. The V value average calculator603 sets the divided block regions into focused regions respectively andcalculates an average of the V values of all pixels in the respectiveregions (which will be hereinafter referred to as an average V value)for two types of key determining regions having different areasrespectively. FIGS. 2A and 2B show a block region 101 in an input image100, and a region shown in a slant line in FIGS. 2A and 2B indicates akey determining region.

More specifically, as shown in FIG. 2A, the V value average calculator603 sets the block region 101 (shown by A in FIG. 2) itself to be afocused region as a first key determining region A, thereby calculatingan average V value. As shown in FIG. 2B, the V value average calculator603 sets, as a second key determining region B, a region constituted bythe block region 101 (shown by A in FIG. 2) to be the focused region andeight other block regions 101 (B1, B2, . . . , B8 in FIG. 2) which areadjacent to surroundings thereof, thereby calculating the average Vvalue.

The first key determination unit 604 determines any brightness level(hereinafter referred to as a first brightness level) in a brightnessreference leveled into a plurality of predetermined levels to which abrightness in the first key determining region A corresponds based onthe average V value in the same region which is calculated by the Vvalue average calculator 603. In the following description, thedetermination process will be referred to as a first key determination.The brightness level to be determined is divided into three levels of“Low”, “Middle” and “High”. A range of the average V value correspondingto each brightness level is obtained by dividing a full range (0 to amaximum value) of the average V value into three equal parts, forexample.

The second key determination unit 605 determines any brightness level(hereinafter referred to as a second brightness level) in a brightnessreference leveled into a plurality of predetermined levels to which abrightness in the second key determining region B corresponds based onthe average V value in the same region which is calculated by the Vvalue average calculator 603. In the following description, thedetermination process will be referred to as a second key determination.The brightness level to be determined is also based on the samereference as that in the first key determination and is “Low”, “Middle”or “High”.

The third key determination unit 606 determines a relevance to abrightness level corresponding to a combination of results of the firstand second key determinations (the first and second brightness levels)that is, any brightness level (hereinafter referred to as a thirdbrightness level) in a brightness reference leveled in more detail thanthe brightness reference described above. In other words, the third keydetermination unit 606 determines a brightness level considering arelative brightness relationship between the eight other block regions101 (B1, B2, . . . , B8) which are adjacent to the surroundings of theblock region 101 to be the focused region for the same block region 101.

In the embodiment, a brightness level to be determined in the third keydetermination is any of six levels including “Low 1”, “Low 2”, “Middle1”, “Middle 2”, “High 1” and “High 2”, and the “Low 1” indicates thelowest level and the “High 2” indicates the highest level. Moreover, arelationship between a combination of the first and second brightnesslevels and the third brightness level is previously defined as shown inFIG. 3, for example.

The V value average calculator 603, the first key determination unit604, the second key determination unit 605 and the third keydetermination unit 606 serve as a first acquiring unit.

The face detecting unit 607 detects a face portion where a human face ispositioned in an input image (a static image) and has a predeterminedsize or more, acquires coordinate information about a correspondingregion (a face region) to the face portion thus detected, and outputsthe same coordinate information to the Y value average calculator 609and the correction gain calculator 614. The face detecting unit 607serves as face detecting unit, and more specifically, is configured by atemporary memory for image data, an image processing circuit, and aplurality of registers for storing a parameter to be used in a facedetecting operation. In the embodiment, a well-known method usingpattern matching for detecting a face portion having a close feature toa model pattern such as a contour or a color about a face of a personwhich is prepared (previously stored) can be applied to a method ofdetecting a face portion. Moreover, it is preferable that the faceregion acquired as the coordinate information is set to be a rectangularregion corresponding to the detected face portion.

The Y value converter 608 converts pixels values (R, G and B values) ofimage data input to the input unit 601 into a Y (brightness) value in aYUV color space and outputs the converted Y value to the Y value averagecalculator 609. The Y value is converted in accordance with thefollowing equation (13).

Y=0.299×R+0.587×G+0.114×B   (13)

The Y value average calculator 609 calculates the face portion in theinput image detected by the face detecting unit 607 and an average of Yvalues of all pixels in at least one block region including a part orwhole of the face portion (which will be hereinafter referred to as anaverage Y value), respectively. In the following description, at leastone block region including a part or whole of the face portion, that is,overlapping with the face portion will be referred to as a face block ina lump. FIG. 12 is an explanatory diagram showing the block region 101,a face portion C and the face block D in the input image 100,illustrating an example of the case in which the face block D isconfigured by four block regions 101 (D1 to D4 in FIG. 12).

The face portion key determination unit 610 serves to determine any ofthe brightness levels in the brightness reference leveled into aplurality of predetermined levels to which a brightness in the regioncorresponds based on the average Y value in the face portion Ccalculated by the Y value average calculator 609. The brightness levelto be determined is based on the same brightness reference (thebrightness levels in six levels) as that in the third key determination.The face portion key determination unit 610 and the Y value averagecalculator 609 function as second acquiring unit.

The face block key determination unit 611 determines a corresponding oneof the brightness levels through the same brightness reference as thatin the third key determination in the same manner as the face portionkey determination unit 610 based on the average Y value of each of theblock regions 101 belonging to the face block D calculated by the Yvalue average calculator 609 respectively, and finally determines, asthe brightness level of the face block D, the brightness level obtainedby averaging the brightness levels of the respective block regions 101thus determined.

The brightness level is averaged by specifically assigning level valuesof 1 to 6 to the brightness levels in six levels to calculate theaverage of the level values (to round figures below a decimal point).For example, if the brightness levels of the block regions 101 (D1 toD4) belonging to the face block D shown in FIG. 12 are “Low 2”, “Middle1”, “High 1” and “High 2” respectively, the average of the level valuesis (2+3+5+6)/4=4 and the “Middle 2” corresponding to a level value of“4” is set to be the brightness level of the face block D. The faceblock key determination unit 611 and the Y value average calculator 609function as third acquiring unit.

It is sufficient that the brightness reference for determining thebrightness level of the face block D in the face block key determinationunit 61.1 is identical to the brightness reference for determining thebrightness level of the face portion C in the face portion keydetermination unit 610, and the brightness levels of the face portion Cand the face block D may be determined based on the brightness referenceleveled into a plurality of levels which are different from that in thethird key determination.

The determination adjustment unit 612 serves as an adjustment unit andserves to adjust a result of the third key determination (a thirdbrightness level) in the third key determination unit 606 based on theresults of the key determinations through the face portion keydetermination unit 610 and the face block key determination unit 611,that is, the brightness level of the face portion C and the averagedbrightness level of the face block D for each of the block regions 101belonging to the face block D.

Details of the adjustment are shown in FIG. 13. The determinationadjustment unit 612 compares the brightness level of the face portion Cwith that of the face block D (step S101) and shifts the brightnesslevel of each of the block regions 101 belonging to the face block Dtoward a bright side depending on a difference between the brightnesslevel of the face portion C and that of the face block D if thebrightness level of the face portion C is higher, that is, the faceportion C is brighter (YES in step S102) (step S103).

To the contrary, if the brightness level of the face block D is higher,that is, the face block D is brighter (NO in step S102 and YES in stepS104), the brightness level of each of the block regions 101 belongingto the face block D is shifted toward a dark side depending on thedifference between the brightness level of the face portion C and thatof the face block D (step S105).

If the brightness level of the face portion C and that of the face blockD are identical to each other (NO in both of steps S102 and S104), thebrightness level of each of the block regions 101 belonging to the faceblock D is exactly maintained (step S106).

In steps S103 and S105, a shift amount in shifting the brightness levelof the block region 101 toward the bright side or the dark sidedepending on the difference between the brightness level of the faceportion C and that of the face block D is an adjustment degree that ispreviously determined. The shift amount is changed by one level everytime the level difference between the face portion C and the face blockD is varied by one level or is changed by one level every time the leveldifference is varied by two levels, for example. It is preferable toincrease the shift amount (adjustment degree) when the differencebetween the brightness level of the face portion C and that of the faceblock D is larger. When the shift amount is excessively increased, thereis also a higher possibility that a balance with the peripheral blockregions 101 might be deteriorated.

Although the description has been given to the case in which the facedetected in the input image 100, that is, the face portion C exists inone place, the determination adjustment unit 612 adjusts the brightnesslevel for each of the block regions 101 belonging to the face block D ifa plurality of face portions C is detected. In that case, the brightnesslevel of the block region 101 is regulated based on the brightnesslevels of the face portion C and the face block D thereof having ahigher priority as compared with a predetermined reference (an area ofthe face portion C) when the face portions C exist close to each otherand there is a portion overlapping with each face block D (the blockregion 101).

The histogram generator 613 counts the number of pixels for each V valuefrom the V values (Vin) of all the pixels converted by the V valueconverter 602, and outputs, to the correction gain calculator 614, aresult of the count as histogram information indicative of adistribution of brightness in the whole input image.

The correction gain calculator 614 serves as a characteristic settingunit (a first characteristic setting unit, a second characteristicsetting unit and a third characteristic setting unit), a calculationunit and a determination unit The correction gain calculator 614individually calculates a correcting gain in a gain adjustment for eachpixel through the tone converter 616 by using a gain function (acorrection function) which will be described below, that is, acorrection coefficient for a tone correction which is to be multipliedby each pixel value of image data based on the brightness level to bethe result of the third key determination which is output from thedetermination adjustment unit 612 or the brightness level obtained afterthe adjustment and the histogram information, and sets the correctioncoefficient to the tone converter 616.

The coordinate counter 615 counts a coordinate position (a transverseposition and a longitudinal position) of a pixel to be a gaincalculating target in the correction gain calculator 614.

The tone converter 616 serves to adjust a gain of image data every pixelwith the gain calculated for each pixel in the correction gaincalculator 614. More specifically, the tone converter 616 converts thepixel value (the R, G or B value) of each pixel into a pixel valueobtained by multiplying the gain coefficient. The tone converter 616outputs, to the output unit 617, image data obtained after the gainadjustment.

The output unit 617 is a frame memory or a video RAM which isimplemented by a semiconductor memory chip, for example. The output unit617 may be configured by the same component as the input unit 601.

In the embodiment, the correction gain calculator 614 and the toneconverter 616 serve as a correction unit.

Detailed description will be given to the operation for calculating acorrecting gain in the correction gain calculator 614. First, thecorrection gain calculator 614 individually sets, to all of the pixels,a gain adjustment characteristic for a change in the V value of each ofthe pixels which is a basis in the gain calculation, that is, acorrection characteristic obtained by a gain function which will bedescribed below.

More specifically, there is set, as a typical correction characteristic,a correction characteristic corresponding to the third brightness leveldetermined every block region 101 through the third key determinationfrom plural types of correction characteristics which are predeterminedcorresponding to the brightness levels in the six levels including the“Low 1”, “Low 2”, “Middle 1”, “Middle 2”, “High 1” and “High 2” (seeFIG. 3) for a center pixel of each of the block regions 101.

A new correction characteristic is acquired through a linearinterpolation from the typical correction characteristic set to thecenter pixels which are adjacent to pixels other than the center pixeland is set to the pixels other than the center pixel. Referring to theinterpolation of the correction characteristic set to the other pixels,it is also possible to employ another interpolating method such as aspline interpolation in addition to the linear interpolation.

FIG. 4A is a diagram showing nine block regions obtained by dividing theinput image 100 and their center pixels (“+” in the drawing) and FIG. 4Bis a diagram showing a relationship between pixels other than the centerpixel (“·” in the drawing) and the center pixel used for an acquirement(interpolation) of the correction characteristic of the pixel. As shownin FIG. 4B, in the interpolation of the correction characteristics setto the other pixels, the typical correction characteristics for fourcenter pixels at a maximum which are adjacent to the same pixels areused. Referring to the pixels in the block regions positioned in upper,lower, left and right corner portions of the input image, the typicalcorrection characteristics set to the center pixels in the block regionsare exactly set as the correction characteristics. Next, detaileddescription will be given to the typical correction characteristic andthe correction characteristic.

The typical correction characteristic and the correction characteristicwhich are set to each pixel are obtained by a gain function g (Vin, lev,x) expressed in Equation (2) shown in FIG. 5A. The correction gaincalculator 614 sets, as the typical correction characteristic or thecorrection characteristic for each pixel, values of a gain level (lev)and a degree (x) to be parameters (variables) for predetermining thecharacteristic in the gain function g (Vin, lev, x).

FIGS. 5B and 5C are charts showing an adjustment characteristic of thegain (g) for a change in the V value (Vin) obtained by the gain functiong (Vin, lev, x), and the gain (g) calculated through the gain function g(Vin, lev, x) is decreased with an increase in the V value (Vin) and is1.0 with the V value which is equal to a maximum value. Moreover, adifference in the value of the parameter is reflected by thecharacteristic in the following manner.

More specifically, a value of the degree (x) is equal as shown in FIG.5B, the whole gain (g) is increased with an increase in the gain level(lev) and a maximum value of the gain (g) is a double with “lev=2”. Inthe case in which a value of the gain level (lev) is equal as shown inFIG. 5C, the gain (g) in a region having a middle brightness,particularly, a highlight (a maximum V value) side is reduced with anincrease in the degree (x) and the gain (g) on the highlight side (alarger V value side) is equal to or smaller than 1.0 depending on thevalue.

In other words, when the gain set to the gain converter 616 is to becalculated every pixel by using the gain function g (Vin, lev, x), it ispossible to enhance a tone in a dark portion of the input image if thegain level (lev) is increased to wholly cause the gain to be larger. Atthe same time, it is possible to reduce a whiteout in a bright portionof the input image if the degree (x) is increased to cause the gain onthe highlight (the maximum V value) side to be equal to or smaller than1.0.

For this reason, a value decreased in order with an increase in thebrightness level is set to the gain level (lev) corresponding to each ofthe brightness levels in the six levels (“Low 1”, . . . , “High 2”) anda value increased in order with the increase in the brightness level isset to the degree (x) corresponding to each of the brightness levels,which is not shown. Moreover, the values of both of the parameters (lev,x) are previously determined based on an empirical rule.

In the correction gain calculator 614, the gain function g (Vin, lev, x)is not exactly used to calculate the gain but the gain is calculatedthrough a gain function glim (Vin, lev, x) expressed in Equation (3)shown in FIG. 6A.

The parameter (lim) in the gain function glim (Vin, lev, x) is a gainlimit coefficient for determining the upper limit of the gain. Bysetting the value to be equal to or smaller than 1.0, it is possible toadjust the upper limit of the gain corresponding to the value of thegain level (lev) In the embodiment, a value of the gain limitcoefficient is set to be equal over the whole image (all pixels). In thefollowing description, the gain function glim (Vin, lev, x) will besimply referred to as a “limited gain function”.

FIG. 6B is a chart showing an adjustment characteristic of a gain for achange in the V value of each pixel with “lim=1”. In this case, there isobtained the same characteristic as that in the case in which the gainlimit is not performed. FIG. 6C is a chart showing an adjustmentcharacteristic of a gain for a change in the V value of each pixel with“lim=0.5”. By setting the gain limit coefficient to be smaller than 1.0,it is possible to reduce the gain for the pixel on a side where the Vvalue is larger when the value of the gain level (lev) is smaller. Inother words, it is possible to enhance a contrast of an image (i.e. theblackness of the dark portion) by reducing the gain for a pixel in thedark portion.

In the embodiment, in the case in which a face portion of an optionalperson having a predetermined size or more is detected from the inputimage through the face detecting unit 607, a value calculated byEquation (14) shown in FIG. 14A is set to the gain limit coefficient(lim). In Equation (14), the parameter Yave_face represents an average Yvalue of the face portion C (see FIG. 12) calculated by the Y valueaverage calculator 9. The parameters lev_face and x face represent again level (lev) and a degree (x) which are set as a typical correctioncharacteristic to the closest center pixel to central coordinates of theface portion C in the center pixel of each of the block regions 101. Thefunction g (Yave, lev_face, x_face) represents a gain corresponding tothe average Y value of the face portion calculated in accordance withthe typical correction characteristic of the center pixel, and a ratioof the gain level (lev_face) of the typical correction characteristic tothe gain (hereinafter referred to as a face portion gain) is representedas a gain limit coefficient (lim).

FIG. 14B is a chart showing an adjustment characteristic of a gain withrespect to a change in a V value of each pixel which is obtained byusing the gain limit coefficient (lim) acquired as described above. Inother words, the gain limit coefficient (lim) is set to be a valuecalculated by the equations described above so that the gain for a pixelhaving a smaller V value than the average Y value of the face is limitedto a gain g(Yave, lev_face, x_face), which corresponds to the average Yvalue of the face portion.

Consequently, there is performed a contrast enhancement to whichimportance is attached to a tone of the face portion in the image (whichwill be hereinafter referred to as a “face prioritized contrastenhancement”).

In the case in which the face portion of the optional person having thepredetermined size or more is not detected from the input image throughthe face detecting unit 607 differently from the above description, acontrast determination for determining (estimating) a contrast status ofthe input image is performed based on the result of the third keydetermination to set a value corresponding to the result of thedetermination.

More specifically, the number of the block regions in the “Low 1” inwhich the brightness level is the lowest in the third key determinationand that of the block regions in the “High 2” in which the brightnesslevel is the highest are individually counted and it is ascertainedwhether each count number is equal to or larger than a threshold (N, M)determined every level or is smaller than the threshold (N, M) for bothof the brightness levels. The contrast status is determined based on acombination of the number of the “Low 1” (the number which is equal toor larger than N and the number which is smaller than N) and the numberof the “High 2” (the number which is equal to or larger than M and thenumber which is smaller than M) and the gain limit coefficient is setcorresponding to the result of the determination.

For example, in the case in which the contrast status is divided intofour levels to perform a determination, it is determined that thecontrast of the image is the highest and the value of the gain limitcoefficient is set to be “1.0” when the number of the Low 1” is equal toor larger than the threshold (N) and the number of the “High 2” is equalto or larger than the threshold (M). In other words, the contrastenhancement is not substantially performed. When the number of the “Low1” is smaller than the threshold (N) and the number of the “High 2” issmaller than the threshold (M), it is determined that the contrast ofthe image is the lowest and the value of the gain limit coefficient isset to be “0.5”.

On the other hand, it is possible to perform the enhancement in the facepriority contrast by using the limited gain function to adjust the upperlimit of the gain for each pixel. Also in that case, as shown in FIG.5C, the gain (g) on the highlight side (the side where the V value isgreat) excluding a highlight portion (a pixel portion having the V valueto be a maximum value) is equal to or smaller than 1.0 when the value ofthe degree (x) set to each pixel is increased to some degree in thecalculation of the gain. In other words, a pixel value of a brightportion in the image is subjected to a negative correction.

This causes a useless reduction in a contrast in an image having a poortone in a bright portion and results in a tone jump in which a greattone difference is made between a portion having a whiteout causedtherein and a close portion to the whiteout therearound (the vicinity ofthe maximum value of the V value) in an image having a large whiteout (alarge number of whiteout portions).

For this reason, in the correction gain calculator 614, it is determinedwhether or not the negative correction of a pixel value for a pixel in abright portion is inappropriate for the input image, that is, the inputimage has a poor tone in the bright portion or a large whiteout in thecalculation of the gain of each pixel) (which will be hereinafterreferred to as a highlight determination). If it is determined that thenegative correction is inappropriate for the image, a gain is calculatedthrough a gain function gclip (Vin, lev, x) expressed in Equation (4)shown in FIG. 8A.

In other words, by clipping (limiting) a lower limit of the gain to“1.0”, it is possible to avoid a useless reduction in a contrast in thecase in which the input image has a poor tone in the bright portion anda generation of a tone jump in the case in which the image has a largewhiteout. In the following description, the gain function gclip (Vin,lev, x) will be simply referred to as a “clipped gain function”.

FIGS. 8B and 8C are charts showing a difference in an adjustmentcharacteristic of a gain depending on the presence of the clip in thecase in which the value of the gain limit coefficient (lim) is set to be“1.0”. FIG. 8B shows an adjustment characteristic obtained when the clipis not performed and FIG. 8C shows an adjustment characteristic obtainedwhen the clip is performed.

In the embodiment, the highlight determination is performed in thefollowing manner based on the histogram information acquired by thehistogram generator 613 (the distribution of brightness depending on thenumber of pixels for each V value in the whole image). Morespecifically, as shown in an upper section of FIG. 9, when the number ofpixels having a larger tone value than a tone value X in a tone positionfrom a maximum tone value (a maximum V value) to several percent (forexample, 5% to 10%) is equal to or smaller than a predetermined certainnumber, it is determined that the input image has a poor tone in thebright portion and the negative correction is inappropriate for theinput image. As shown in a lower section of FIG. 9, when the number ofpixels of the maximum tone value (the maximum V value) is equal to orlarger than the predetermined certain number, it is determined that theinput image has a large whiteout and the negative correction isinappropriate for the input image. As shown in a middle section of FIG.9, when the number of pixels having a larger tone value than a tonevalue X exceeds the predetermined certain number and the number ofpixels having the maximum tone value (the maximum V value) is smallerthan the predetermined certain number, that is, the same numbercorresponds to neither of the two determining conditions, it isdetermined that the input image has a high tone in the bright portionand the negative correction is appropriate for the input image.

The histogram information to be used for the highlight determinationindicates the distribution of brightness depending on the number ofpixels for each V value to be a maximum value for each of the R, G and Bvalues. For this reason, also in the case in which the input image has alarge number of portions in which a color saturation is generated, it ispossible to determine that the negative correction is inappropriate forthe input image in the same manner as in an image having a largewhiteout. Therefore, it is possible to simultaneously avoid thegeneration of the tone jump in the vicinity of the portion in which thecolor saturation is generated in addition to the tone jump in thevicinity of the portion in which the whiteout is generated.

As described above, the correction gain calculator 614 calculates a gainfor each pixel by using the clipped gain function gclip (Vin, lev, x) inthe case in which a gain clip is required for the input image and setsthe same gain as a correcting gain to the tone converter 616 dependingon the result of the highlight determination. Furthermore, thecorrection gain calculator 614 calculates a gain for each pixel by usingthe limited gain function glim (Vin, lev, x) in the case in which a gainclip is not required for the input image and sets the same gain as acorrecting gain to the tone converter 616.

The tone converter 616 adjusts a pixel value of image data every pixelwith the gain calculated corresponding to the result of the highlightdetermination through the correction gain calculator 614. Morespecifically, pixel values Rin, Gin and Bin for R, G and B of respectivepixels which are input are converted into pixel values Rout, Gout andBout obtained in accordance with the following equations (15), (16) and(17) or equations (18), (19) and (20).

Rout=Rin×glim(Vin, lev, x)   (15)

Gout=Gin×glim(Vin, lev, x)   (16)

Bout=Bin×glim(Vin, lev, x)   (17)

Rout=Rin×gclip(Vin, lev, x)   (18)

Gout=Gin×gclip(Vin, lev, x)   (19)

Bout=Bin×gclip(Vin, lev, x)   (20)

In other words, the tone converter 616 individually corrects abrightness level (brightness) of each pixel of the input image inaccordance with a correction characteristic set to each pixel.Consequently, it is possible to automatically correct the tone of theinput image.

FIGS. 15 and 16 are flowcharts showing details of an operation by thetone correcting apparatus 600. Although the details of respective stepsshown in FIGS. 15 and 16 will be omitted in order to reduce repetitivedescription, step S201 indicates an operation of the V value averagecalculator 603, step S202 indicates operations of the first keydetermination unit 604, the second key determination unit 605 and thethird key determination unit 606. Moreover, step S204 indicates anoperation of the face detecting unit 607, step S205 indicates anoperation of the Y value average calculator 609, and step S206 indicatesoperations of the face portion key determination unit 610 and the faceblock key determination unit 611. Moreover, step S207 indicates anoperation of the determination adjustment unit 612. The details of stepS207 are described above with reference to FIG. 13.

Steps S208 to S217 indicate an operation of the correction gaincalculator 614 and step S218 indicates an operation of the toneconverter 616. The operations of steps S217 and S218 are actuallyperformed repetitively at a number of times corresponding to the numberof pixels.

As described above, in the tone correcting apparatus 600 according tothe embodiment, in the case in which a face having a predetermined sizeor more exists in the input image 100, an upper limit of a gain to beset to all of pixels in an adjustment of the gain of the image datainput to the input unit 601 every pixel in the tone converter 616 isregulated depending on a brightness of the face portion C in the inputimage 100. More specifically, as described above, a face prioritizedcontrast enhancement is performed over the input image 100 by using thelimited gain function (see FIGS. 6A and 14A) setting, as a parameter, again limit coefficient (lim) calculated with the average Y value of theface portion C as the gain function to be used for calculating the gainfor each pixel.

Consequently, it is possible to reduce a gain for a pixel in a darkportion such as a portion around eyes or a mouth in the face portion andto cause a tone in the face portion to have a modulation by tighteningthe dark portion of the face to be properly dark. In other words, it ispossible to perform a tone correction to which importance is attached toa face portion of a person in an image. As a result, it is possible tomaintain a appropriate tone in the face portion of the person in thetone correction of the image.

When acquiring the brightness level of each of the block regions 101which is a reference for determining a correction characteristic (atypical correction characteristic) to be set to the center pixel of eachof the block regions 101 prior to an operation for setting thecorrection characteristic to be used for calculating the gain everypixel, the brightness levels of the block regions 101 which are oncedetermined through the first to third determinations are regulated(shifted toward a high level side or a low level side) depending on adifference between the brightness level of the face portion C and anaverage level of the face block D (the average of the brightness levelsof the block regions 101 belonging to the face block D) for the blockregions 101 belonging to the face block D (the block regions 101overlapping with the face portion C and including a part or wholethereof) (see FIG. 12)

Consequently, it is possible to compensate for an excess and deficiencyof a gain for the pixel in the face portion C which is generated when asize of the face portion C is almost equal to that of each of the blockregion 101 or is smaller than that of each of the block regions 101.

For example, when the face portion C is dark and a background is brightas shown in FIG. 17A, the brightness level based on the average V valueof the block region 101 belonging to the face block D is raised if thebrightness level adjustment is not performed. For this reason, the gainlevel of each pixel in the face block D is reduced. As a result, thegain for the pixel in the face portion C is made insufficient. However,it is possible to avoid the insufficiency of the gain for the faceportion C by limiting the brightness level as described above.Consequently, it is possible to eliminate a situation in which the faceportion C is unnaturally darkened with the tone correction.

When the face portion C is bright and the background is dark as shown inFIG. 17B, the brightness level based on the average V value of the blockregion 101 belonging to the face block D is reduced if the brightnesslevel adjustment is not performed. For this reason, the gain level ofeach pixel in the face block D is increased. As a result, the gain forthe pixel of the face portion C is made excessive. However, it ispossible to avoid the excess of the gain for the face portion C bylimiting the brightness level as described above. Consequently, it ispossible to eliminate a situation in which the face portion C isunnaturally brightened with the tone correction.

In other words, by limiting the brightness level of the block region 101belonging to the face block D, it is also possible to perform the tonecorrection in which importance is attached to a face portion of a personin an image. As a result, it is possible to maintain a appropriate tonein the face portion of the person in the tone correction of the image.

In the embodiment, in the calculation of the gain for each pixel, thehighlight determination is performed for the input image and it isdetermined whether the negative correction of the pixel value for theimage in the bright portion is inappropriate for the input image or not.If the negative correction is inappropriate for the image, the lowerlimit of the gain to be set every pixel is clipped (limited) to “1.0”.Consequently, it is possible to prevent a useless reduction in acontrast in the case in which the input image has a poor tone in thebright portion, and a generation of a tone jump in the case in which theinput image has a large whiteout and the generation of the tone jumparound a portion in which a color saturation is caused.

It is desirable to execute the face prioritized contrast enhancement andthe adjustment of the brightness level of the block region 101 belongingto the face block D at the same time as in the embodiment. However, theydo not always need to be executed at the same time and only one of themmay be executed.

In the description, in the tone correction of the input image 100, thecorrection characteristic (gain function) is set every pixel and thebrightness of the pixel is individually corrected in accordance with thecorrection characteristic thus set. However, a specific method ofindividually correcting the brightness of each pixel in the tonecorrecting apparatus 600 is not particularly limited but methods otherthan the method described above may be employed.

Also in the case in which the other method is employed, it is possibleto perform the tone correction in which importance is attached to theface portion of the person in the image by individually correcting thebrightness of each pixel based on the brightness information of each ofthe block regions 101 and that of the face portion C. Consequently, itis possible to maintain a appropriate tone in the face portion of theperson.

In the embodiment, in the case in which the face having thepredetermined size or more exists in the input image 100, the gain to beset to each pixel is calculated by using the limited gain function glim(Vin, lev, x) shown in FIG. 6A. By setting a value acquired based on thebrightness level of each of the block regions 101 and that of the faceblock D to the parameter of the gain function glim (Vin, lev, x), thereis performed the face prioritized contrast enhancement in whichimportance is attached to the tone of the face portion. However, theprocessing may be changed as follows, for example.

For example, by using the gain function g (Vin, lev, x) to be the basisshown in FIG. 5A, it is also possible to set, every pixel, thecorrection characteristic based on the brightness level of each of theblock regions 101, to once calculate the gain of each pixel inaccordance with the correction characteristic thus set and to correctthe calculated gain based on the brightness level of the face block D.In addition, by previously determining the brightness level of each ofthe block regions 101 to be slightly higher based on the brightnesslevel of the face block D, it is also possible to restrict the upperlimit of the gain for each pixel as a result.

In the embodiment, the brightness level of the block region 101belonging to the face block D in each of the block regions 101 isregulated depending on the difference between the brightness level ofthe face portion C and that of the face block D, and the typicalcorrection characteristic is set to the center pixel of the block region101 belonging to the face block D based on the brightness level afterthe adjustment to compensate for the excess and deficiency of the gainfor the pixel of the face portion C. However, the processing may bechanged as follows, for example.

For example, when setting the typical correction characteristic to thecenter pixels of the block regions 101 belonging to the face block Drespectively without limiting the brightness level of the block region101 as described above, it is also possible to set typical correctioncharacteristics considering the difference between the brightness levelof the face portion C and that of the face block D respectivelydifferently from other general block regions 101.

Referring to the block region 101 belonging to the face block D, whendetermining the brightness level, it is also possible to consider arelative relationship in a brightness between the block region 101 andeight other block regions 101 which are adjacent to the surroundingsthereof, and furthermore, to previously decide the brightness level inconsideration of the difference between the brightness level of the faceportion C and that of the face block D and to set the typical correctioncharacteristic to the center pixel of the block region 101 belonging tothe face block D based on the result of the determination in accordancewith the same reference as that in the other block regions 101.

Furthermore, it is also possible to once determine the typicalcorrection characteristic to be set to the center pixel of each of theblock regions 101 corresponding to the brightness level of the blockregion 101 without limiting the brightness level of the block region 101belonging to the face block D as described above, and to then changeonly the typical correction characteristic of the block region 101belonging to the face block D into a correction characteristicconsidering the difference between the brightness level of the faceportion C and that of the face block D.

Moreover, the typical correction characteristic to be set to the centerpixel of the block region 101 belonging to the face block D may bedirectly determined based on a combination of the brightness level ofthe same block region 101 and a difference between the brightness levelof the face portion C and that of the face block D.

In the embodiment, the input image 100 is divided into the block regions101 and the brightness level (brightness information) is acquired foreach of the block regions 101. However, the block region in which thebrightness level is acquired does not always need to be obtained bydividing the input image 100 but may be set to be the block region andit is also possible to set the block regions in which the adjacent blockregions partially overlap with each other.

In the embodiment, the average Y value is acquired as the brightnessinformation of the face portion C and the brightness level of each ofthe block regions 101 belonging to the face block D is determined basedon the average Y value. However, the average V value may be acquired asthe brightness information of the face portion C and the brightnesslevel of each of the block regions 101 may be determined based on theaverage V value. In that case, the face portion of the person generallytakes a skin color having an R component in a large amount. Therefore,the average V value is larger than the average Y value. In other words,the brightness levels of the face portion C and the face block D areincreased. For this reason, it is necessary to adjust the brightnesslevel of each of the block regions 101 belonging to the face block Dacquired finally in consideration of the foregoing or to calculate thegain limit coefficient (lim) in the face prioritized contrastenhancement.

While the brightness levels of the first and second key determiningregions A and B are divided in the three levels including “Low”,“Middle” and “High”, the number of the levels of the brightness level tobe determined may be two or four or more. In addition, the numbers ofthe levels of the brightness levels to be determined in the first andsecond key determining regions A and B may be different from each other.

In the case in which the numbers of the levels are set to be equal toeach other in the same manner as in the embodiment, it is also possibleto perform weighting over the result of the second key determination bychanging criteria in the first key determination for the first keydetermining region A and the second key determination for the second keydetermining region B, that is, a relationship between the average Vvalue and the brightness level, for example.

Although the brightness level of each of the block regions 101 which isto be determined in the third key determination, that is, the brightnessto be the reference for determining the typical correctioncharacteristic set to each of the center pixels is determined in the sixlevels including the “Low 1” to “High 2”, the number of the levels maybe changed. It is possible to perform the tone correction more preciselyin a larger number of levels for the brightness level to be determinedFor this reason, it is desirable that the number of the levels for thebrightness level to be determined in the third key determination shouldbe larger than that of the levels for the brightness level in thedetermination of the brightness in each of the first and second keydetermining regions A and B as in the embodiment.

While the brightness level of each of the block regions 101 isdetermined based on the V value of each pixel (more specifically, theaverage V value of each of the block regions), the same brightness levelmay be determined based on other brightness information such as a Y(brightness) value obtained from the R, G and B values of each pixel. Insome cases in which the brightness information other than the V value isused, the color saturation cannot be determined in the highlightdetermination and an unnecessary gain is given to the color saturationportion. For this reason, it is desirable to use the V value for thebrightness information.

In the embodiment, the second key determining region to be the targetregion for acquiring the second brightness level is set to be the region(the inclusive region) B constituted by the block region 101 (A in FIG.2B) to be the focused region and eight other block regions 101 which areadjacent to the surroundings thereof (B1, B2, . . . B8 in FIG. 2B).However, the target region for acquiring the second brightness level isnot limited thereto in the invention. For example, only the eight otherblock regions which are adjacent to the surroundings of the focusedregion may be set to be the second key determining region or some of theeight other block regions which are adjacent to the surroundings of thefocused region (B2, B4, B5 and B7 in FIG. 2B) may be set to be thesecond key determining region.

Furthermore, each component of the tone correcting apparatus 600 may beimplemented by an ASIC (application specific integrated circuit). Inaddition, in the functions implemented by the tone correcting apparatus600, the functions of a whole or part of the portions other than theinput unit 601 and the output unit 617 may be implemented in accordancewith a software program to be executed by a processor provided in acomputer, an imaging apparatus or an image processing apparatus, forexample. In the case in which the function to be implemented by the tonecorrecting apparatus 600 is to be implemented into the imaging apparatussuch as a digital camera or a digital video camera, for example, it isalso possible to run a tone correcting program for performing a tonecorrection processing shown in FIGS. 13, 15 and 16 through a processorincluded in a computer system provided in the apparatuses. The tonecorrecting program can be provided in a form of a recording medium, forexample, a non-volatile memory such as a mask ROM or an EPROM (ErasableProgrammable ROM), a flash memory device, an optical disk or a magneticdisk. Moreover, the tone correcting program may be provided through awired or wireless computer network.

It is to be understood that the present invention is not limited to thespecific embodiments described above and that the invention can beembodied with the components modified without departing from the spiritand scope of the invention. The invention can be embodied in variousforms according to appropriate combinations of the components disclosedin the embodiments described above. For example, some components may bedeleted from all components shown in the embodiments. Further, thecomponents in different embodiments may be used appropriately incombination.

1. A tone correcting apparatus for correcting a tone of an image, theapparatus comprising: a first acquiring unit that acquires firstbrightness information indicating brightness of each of a plurality ofblock regions that are set to cover an entire area of the image; a facedetecting unit that detects a face portion where a human face ispositioned in the image; a second acquiring unit that acquires secondbrightness information indicating brightness of the face portiondetected by the face detecting unit; and a correction unit that correctsbrightness of the image based on the first brightness information andthe second brightness information.
 2. The apparatus according to claim 1further comprising a characteristic setting unit that sets a correctioncharacteristic for each of pixels in the image based on the firstbrightness information and the second brightness information, whereinthe correction unit corrects the brightness of each of the pixels inaccordance with the correction characteristic set for the respectivepixels by the characteristic setting unit.
 3. The apparatus according toclaim 2, wherein the correction characteristic setting unit sets, as thecorrection characteristic, an adjustment characteristic of a correctioncoefficient with respect to a change in brightness of the respectivepixels, and wherein the correction characteristic setting unit adjusts amaximum value of the adjustment characteristic for the respective pixelsin accordance with second brightness information.
 4. The apparatusaccording to claim 3 further comprising a calculation unit thatcalculates the correction coefficient with a correction function,wherein the characteristic setting unit sets the correctioncharacteristic for the respective pixels by setting a variable of thecorrection function based on the first brightness information and thesecond brightness information.
 5. The apparatus according to claim 2,wherein the characteristic setting unit includes: a first characteristicsetting unit that sets a first correction characteristic for a givenblock region selected from among the block regions, the first correctioncharacteristic being selected from among a plurality of correctioncharacteristics in accordance with the first brightness information forthe respective block regions; a second characteristic setting unit thatsets a second correction characteristic for the respective block regionsexcept the given block region, the second correction characteristicbeing obtained based on the first brightness information and the secondbrightness information; and a third characteristic setting unit thatsets a third correction characteristic for each of the pixels based onthe first correction characteristic and the second correctioncharacteristic.
 6. The apparatus according to claim 5, wherein the thirdcharacteristic setting unit sets the first correction characteristic fora center pixel in each of the respective block regions and sets a fourthcorrection characteristic for the pixels except the center pixel, thefourth correction characteristic being obtained by interpolating thefirst correction characteristic set for at least one of the center pixelthat is adjacent to the respective pixels.
 7. The apparatus according toclaim 1, wherein the first acquiring unit acquires the first brightnessinformation for the respective block regions based on a V value, in anHSV color space, of the pixels included in the respective block regions,and wherein the second acquiring unit acquires the second brightnessinformation for the face portion based on a Y value, in a YUV colorspace, of the pixels included in the face portion.
 8. The apparatusaccording to claim 1, wherein the correction unit corrects thebrightness of each of the pixels included in a face block, whichincludes at least one of the block regions that overlaps the faceportion, based on the first brightness information and the secondbrightness information.
 9. The apparatus according to claim 8, whereineach of the first brightness information and the second brightnessinformation indicate a brightness level of the respective block regionsand the face portion, wherein the apparatus further comprises a thirdacquiring unit that acquires an average level by averaging thebrightness levels of the block regions that belong to the face blockbased on pixel information indicating information of the pixels in theimage, wherein the correction unit includes a comparing unit thatcompares the brightness level acquired by the second acquiring unit andthe average level acquired by the third acquiring unit, and wherein thecorrection unit corrects the brightness of each of the pixels includedin the face block based on a result of the comparison by the correctionunit.
 10. The apparatus according to claim 9, wherein the correctionunit includes an adjustment unit that operates to: increase thebrightness of the block regions that belong to the face block when thecomparing unit compares that the brightness level acquired by the secondacquiring unit is higher than the average level acquired by the thirdacquiring unit; and decrease the brightness of the block regions thatbelong to the face block when the comparing unit compares that thebrightness level acquired by the second acquiring unit is lower than theaverage level acquired by the third acquiring unit.
 11. The apparatusaccording to claim 8, the first acquiring unit acquires the firstbrightness information for the respective block regions based on a Vvalue, in an HSV color space, of the pixels included in the respectiveblock regions, and wherein the second acquiring unit acquires the secondbrightness information for the face portion based on a Y value, in a YUVcolor space, of the pixels included in the face portion.
 12. Theapparatus according to claim 1 further comprising a determination unitthat determines whether or not the face portion is detected in the imageby the detecting unit, wherein the correction unit corrects brightnessof the image based on the first brightness information and the secondbrightness information when the determination unit determines that theface portion is detected by the detecting unit.
 13. The apparatusaccording to claim 1 further comprising: a first determination unit thatdetermines which one of first brightness levels that are previouslydefined a focused region corresponds to, the focused region beingselected from among the block regions; and a second determination unitthat determines which one of second brightness levels that arepreviously defined an adjacent block region corresponds to, the adjacentblock region being at least one of the block regions that is adjacent tothe focused region, wherein the first acquiring unit acquires thebrightness of the focused region based on a combination of the firstbrightness level determined by the first determination unit and thesecond brightness level determined by the second determination unit. 14.A method for correcting a tone of an image, the method comprising:acquiring first brightness information indicating brightness of each ofa plurality of block regions that are set to cover an entire area of theimage; detecting a face portion where a human face is positioned in theimage; acquiring second brightness information indicating brightness ofthe face portion; and correcting brightness of the image based on thefirst brightness information and the second brightness information. 15.A computer-readable storage medium containing a sequence of instructionsfor a program executable by a computer for correcting a tone of animage, the program comprising: instructions for acquiring firstbrightness information indicating brightness of each of a plurality ofblock regions that are set to cover an entire area of the image;instructions for detecting a face portion where a human face ispositioned in the image; instructions for acquiring second brightnessinformation indicating brightness of the face portion; and instructionsfor correcting brightness of the image based on the first brightnessinformation and the second brightness information.